Skip to content

Conversation

wpaulino
Copy link
Contributor

This also addresses follow-ups from #3889.

@wpaulino wpaulino requested review from TheBlueMatt and jkczyz August 21, 2025 17:02
@wpaulino wpaulino self-assigned this Aug 21, 2025
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Aug 21, 2025

👋 Thanks for assigning @jkczyz as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, aside from the last commit.

@TheBlueMatt
Copy link
Collaborator

Also CI is sad.

The `handle_channel_resumption` path is reachable from both channel
reestablish and monitor update completion. Since we only want to sign
once we know the monitor update has completed, it's possible we could
have unintentionally attempted to sign if we were still pending the
monitor update but had a channel reestablish occur.
This is reachable if the event doesn't get handled and a channel
reestablish occurs.
@wpaulino wpaulino force-pushed the sign-splice-shared-input branch from 1512cd9 to 8c9cc05 Compare August 26, 2025 16:13
@wpaulino wpaulino requested review from TheBlueMatt and jkczyz August 26, 2025 16:14
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 61.42857% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.74%. Comparing base (9724d19) to head (e664b7e).
⚠️ Report is 71 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/interactivetxs.rs 59.54% 42 Missing and 11 partials ⚠️
lightning/src/sign/mod.rs 0.00% 12 Missing ⚠️
lightning/src/ln/channelmanager.rs 40.00% 8 Missing and 1 partial ⚠️
lightning/src/util/test_channel_signer.rs 0.00% 4 Missing ⚠️
lightning/src/ln/channel.rs 93.75% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4024      +/-   ##
==========================================
- Coverage   88.77%   88.74%   -0.03%     
==========================================
  Files         175      176       +1     
  Lines      127846   128638     +792     
  Branches   127846   128638     +792     
==========================================
+ Hits       113492   114164     +672     
- Misses      11788    11877      +89     
- Partials     2566     2597      +31     
Flag Coverage Δ
fuzzing 21.83% <12.74%> (-0.26%) ⬇️
tests 88.58% <61.42%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

TheBlueMatt
TheBlueMatt previously approved these changes Aug 26, 2025
inputs
.iter()
.position(|input| {
input.txin.previous_output == shared_funding_input.input.previous_output
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we fail or assert if we can't find the shared input?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just checked for it at the top of the method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, didn't see the whole context. Was thinking we could move the shared_input_index there, but I guess we can't because sorting would make it invalid.

Comment on lines +606 to +593
let mut witness = Witness::new();
witness.push(Vec::new());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you comment on why an empty Vec is pushed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bug in OP_CHECKMULTISIG that pops an extra argument from the stack than what is required, so all witnesses for it need this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but a comment in the code would be useful.

})
.unwrap_or(false)
{
debug_assert!(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be reached?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it could? I was thinking it was already covered by the state checks above, so the assert here is really to make sure we catch a mismatch in the splice state.

This commit tracks all data related to the shared input of a splice,
such that a valid witness can be formed upon the splice transaction
finalization.
We also remove the `Result` to make it clear that this method does not
support async operations yet and rename the method to clarify that it is
only intended to be used for the shared input of a splice.
inputs
.iter()
.position(|input| {
input.txin.previous_output == shared_funding_input.input.previous_output
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, didn't see the whole context. Was thinking we could move the shared_input_index there, but I guess we can't because sorting would make it invalid.

Comment on lines +606 to +593
let mut witness = Witness::new();
witness.push(Vec::new());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but a comment in the code would be useful.

@wpaulino
Copy link
Contributor Author

Merging this since the changes after @TheBlueMatt's approval are trivial.

@wpaulino wpaulino merged commit 2772bfd into lightningdevkit:main Aug 27, 2025
25 checks passed
@wpaulino wpaulino deleted the sign-splice-shared-input branch August 27, 2025 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants